import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import Container from '@/layout/base.vue'
import Culture from '../views/community/Culture.vue'
import EDUcation from '../views/community/Education.vue'
export const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'container',
    component: Container,
    meta: {
      title: '首页'
    },
    children: [
      {
        path: '',
        name: 'home',
        component: () => import('@/views/home/index.vue')
      },
      {
        path: 'education',
        name: 'education',
        component: EDUcation,
        meta: {
          title: '社区文化'
        }
      },
      {
        path: 'culture',
        name: 'culture',
        component: Culture,
        meta: {
          title: '社区教育'
        }
      },
      {
        path: 'aged',
        name: 'aged',
        component: () => import('@/views/aged/index.vue'),
        meta: {
          title: '老人信息'
        }
      },
      {
        path: 'agedService',
        name: 'agedService',
        component: () => import('@/views/agedService/index.vue'),
        meta: {
          title: '养老服务'
        }
      },
      {
        path: 'JyOrganization',
        name: 'JyOrganization',
        component: () => import('@/views/JYorganization/index.vue'),
        meta: {
          title: '教育机构分布'
        }
      },
      {
        path: 'KyOrganization',
        name: 'KyOrganization',
        component: () => import('@/views/KYorganization/index.vue'),
        meta: {
          title: '康养机构分布'
        }
      }
    ]
  },
  {
    path: '/403',
    component: () => import('@/views/403.vue')
  }
]
const router = createRouter({
  history: createWebHashHistory(),
  routes
})
router.beforeEach((to, from, next) => {
  setTimeout(() => {
    aplus_queue.push({
      'action':'aplus.sendPV',
      'arguments':[{
        is_auto: false
      }, {
        page_name: to.meta.title,
        page_url: to.fullPath
      }]
    })
    next()
  }, 0);
})
export default router
